import { createStore } from 'vuex'
const store = createStore({
  state: {
    sandboxReady: false,
    chartIsShow: false,
    isReverse: false,
    currentRegionName: '', // 点击当前设备标签的名称
    deviceListId: '', // 设备列表选中项
    deviceList: [], // 所有设备列表数据
    infoFuzzy: [], // 所有型架所在区域位置
    alarmListData: [] // 报警列表
  },
  mutations: {
    setIsReverse (state, value) {
      state.isReverse = value
    },
    setSandboxReady (state, value) {
      state.sandboxReady = value
    },
    setChartIsShow (state, value) {
      state.chartIsShow = value
    },
    setCurrentRegionName (state, value) {
      state.currentRegionName = value
    },
    setDeviceListId (state, value) {
      state.deviceListId = value
    },
    setDeviceList (state, value) {
      state.deviceList = value.filter(item => {
        return (
          item.equipId.includes('GYX-frame') || // 保留型架
          item.equipId.includes('GYX-AGV') || // 保留AGV
          item.equipId.includes('robot') || // 保留机械臂
          item.equipId.includes('GYX-area') // 保留超级壁板
        )
      })
      // console.log('过滤后设备列表', state.deviceList)
    },
    setInfoFuzzy (state, value) {
      state.infoFuzzy = value
    },
    setAlarmListData (state, value) {
      state.alarmListData = value
    }

  },
  actions: {

  },
  // 设置获取
  getters: {
    getChartIsShow: state => {
      return state.chartIsShow
    }
  }
})

export default store
